<?php
/**
 * @package Admin
 * @author Henrique Droog <henridroog@gmail.com>
 * @name ActionForm
 * @since 21/03/2011
 * @version 1.0
 */
class Admin_Form_ActionForm extends Zend_Form{
    public function init(){

        $id = new Zend_Form_Element_Hidden('id');

        // Add an email element
        $titulo = new Zend_Form_Element_Text('name');
        $titulo->setLabel('Título')
                ->setRequired(true)
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->addValidator('StringLength',false,array(0,75));

        // Add an email element
        $modules = new Admin_Model_ControllerMapper();
        $combo = $modules->fetchAll();

        $comboModule = array();
        foreach ($combo as $c){
            $comboModule[$c->id] = $c->name;
        }

        $ativo = new Zend_Form_Element_Select('controller');
        $ativo->setLabel('Controller Pai:')
                ->setRequired(true)
                ->addValidator('NotEmpty')
                ->setMultiOptions($comboModule);

        // Add the submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Enviar')
                ->setAttrib('ignore',true);


        $this->addElements( array($id,$titulo,$ativo,$submit) );
    }
}